package com.me.study.javaCore.io;

import com.mpatric.mp3agic.ID3v1;
import com.mpatric.mp3agic.ID3v2;
import com.mpatric.mp3agic.Mp3File;

import java.util.Objects;

/**
 * 修改 MP3 tag信息 (id3 v2.*)
 *
 * @author ME
 * @date 2021/5/23
 */
public class MP3Edit {

    public static void main(String[] args) throws Exception {
        Mp3File mp3file = new Mp3File("D:\\vedio\\亿级流量（B站）-MP3\\005_能够支撑高并发+高可用+海量数据+备份恢复的redis的重要性.mp3");
        ID3v1 v1Tag = mp3file.getId3v1Tag();
        if (Objects.nonNull(v1Tag)) {
            System.out.println("专辑：" + v1Tag.getAlbum());
            System.out.println("艺术家：" + v1Tag.getArtist());
            System.out.println("标题：" + v1Tag.getTitle());
        }

        ID3v2 v2Tag = mp3file.getId3v2Tag();
        if (Objects.nonNull(v2Tag)) {
            System.out.println(v2Tag);
            System.out.println("专辑：" + v2Tag.getAlbum());
            System.out.println("艺术家：" + v2Tag.getArtist());
            System.out.println("标题：" + v2Tag.getTitle());
        }
    }

}
